package com.costeaalex.blueserver.server;

import com.costeaalex.blueserver.threads.MainThread;

public class BlueServerMonitor extends Thread
	{
	
	private boolean clientStatus=true;
	private boolean isRunning=false;
	private boolean serverRunning=false;
	private MainThread mTL;
	
	public BlueServerMonitor(MainThread mT)
		{
		mTL=mT;
		}
	
	@Override
	public void run()
		{
		isRunning=true;
		
		while(isRunning)
			{
			if(serverRunning)
				{
				if(clientStatus==false)
					{
					clientStatus=true;
					serverRunning=false;
					mTL.clientStoppedResponding();
					}
				}
			}
		
		}
	
	public void setServerStatus(boolean s)
		{
		serverRunning=s;
		}
	
	public synchronized void setClientStatus(boolean c)
		{
		clientStatus=c;
		}
	
	public synchronized void destroy()
		{
		isRunning=false;
		}
	}
